import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "../utils";

/** 获取基础档案-标签分类列表 */
export const getCategoryPage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/label/category/page"), {
    params: filerEmptyVal(params)
  });
};

/** 获取基础档案-标签列表 */
export const getLabelPage = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/label/page"), {
    params: filerEmptyVal(params)
  });
};

/** 基础档案--标签管理列表-新增标签分类 */
export const categoryAdd = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/label/category/add"), { data });
};

/** 基础档案--标签管理列表-新增标签 */
export const labelAdd = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/label/add"), { data });
};

/** 基础档案--标签管理列表-编辑标签分类 */
export const categoryUpdate = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/label/category/update"), {
    data
  });
};

/** 基础档案-标签管理列表-编辑标签 */
export const labelUpdate = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/label/update"), { data });
};

/** 基础档案-标签管理列表-删除标签分类 */
export const categoryDelete = (id?: any) => {
  return http.request<any>(
    "post",
    baseUrlApi(`/label/category/delete?id=${id}`)
  );
};

/** 基础档案-标签管理列表-删除标签 */
export const labelDelete = (id?: any) => {
  return http.request<any>("post", baseUrlApi(`/label/delete?id=${id}`));
};
